home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Interactive Media Design Review 1999
/
Interactive Media Design Review 1999.iso
/
pc
/
allfiles
/
angry
/
intro.dir
/
00001_Script_handlers
next >
Wrap
Text File
|
1999-03-01
|
3KB
|
158 lines
global gLoopList
global fileSep
on startMovie
set gLoopList = []
-- set the exitLock to TRUE
initMovie
repeat with i = 1 to 6
if soundBusy(i) then sound stop i
end repeat
end startMovie
on initMovie
if the machineType = 256 then
put "\" into fileSep
else
put ":" into fileSep
end if
set the keyDownScript to "keyCheck"
end initMovie
on keyCheck
setVolume()
end keyCheck
on setVolume
set inKey = the key
if inKey = "q" OR inKey = "Q" then go to frame "quitArtRight"
if charToNum(inKey) >= charToNum ("0") and charToNum (inKey) <= charToNum ("9") then
set newVol = integer (the key)
if the soundLevel <> newVol then set the soundLevel = newVol
end if
end setVolume
on deg2radian thisMany -- convert degrees to radians
return thisMany * ( (2 * pi()) / 360 )
end deg2radian
on radian2deg thisMany -- convert radians to degrees
return integer(thisMany * ( 360 / (2 * pi()) ))
end radian2deg
on flyGravity theBody, thisMass, thatLoc, thatMass, maxRadius, action
set body1 = theBody
set mass1 = thisMass
set gPoint = thatLoc
set gMass = thatMass
set rMax = maxRadius
set mouseMass = thisMass * 2
set mouseLoc = point(the mouseH, the mouseV)
set deltaLoc = mouseLoc - the loc of sprite(body1)
set dX = getAt(deltaLoc, 1)
set dY = getAt(deltaLoc, 2)
set r = sqrt( dX*dX + dY*dY )
if r = 0 then set r = .01
if r > 60 then set r = 60
set G = 0.01
set F = ( G * mass1 * mouseMass ) / r
-- keep the objects close
if action = "attract" then
set G = 0.01 * (r * 2.1)
else
if r < rMax then -- if the bat's within rMax of the repulsor
set G = -0.01 * (r * 2.1)
else
set G = 0.0 -- else it has no effect
end if
end if
set F = ( G * mass1 * gMass ) / r
set Fx = 0
set Fy = 0 -- so no <void>s are returned
if dX <> 0.0 then
set Fx = F * dX / r
if abs( Fx ) > 2000 then
set Fx = 0.0
end if
end if
if dY <> 0.0 then
set Fy = F * dY / r
if abs( Fy ) > 2000 then
set Fy = 0.0
end if
end if
return [ #X:Fx, #Y:Fy ]
end flyGravity
on calcGravity theBody, thisMass
set body1 = theBody
set mass1 = thisMass
set mouseMass = thisMass * 2
set mouseLoc = point(the mouseH, the mouseV)
set deltaLoc = mouseLoc - the loc of sprite(body1)
set dX = getAt(deltaLoc, 1)
set dY = getAt(deltaLoc, 2)
set r = sqrt( dX*dX + dY*dY )
if r = 0 then set r = .01
if r > 60 then set r = 60
set G = 0.01
set F = ( G * mass1 * mouseMass ) / r
if dX <> 0.0 then
set Fx = F * dX / r
if abs( Fx ) > 2000 then
set Fx = 0.0
end if
end if
if dY <> 0.0 then
set Fy = F * dY / r
if abs( Fy ) > 2000 then
set Fy = 0.0
end if
end if
return [ #X:Fx, #Y:Fy ]
end